Skip to content

refactor(NumberTheory): golf Mathlib/NumberTheory/NumberField/Basic#38279

Open
yuanyi-350 wants to merge 2 commits intoleanprover-community:masterfrom
yuanyi-350:N_3
Open

refactor(NumberTheory): golf Mathlib/NumberTheory/NumberField/Basic#38279
yuanyi-350 wants to merge 2 commits intoleanprover-community:masterfrom
yuanyi-350:N_3

Conversation

@yuanyi-350
Copy link
Copy Markdown
Collaborator

  • refactors NumberField/Basic by replacing the hand-written mapRingHom structure with f.toIntAlgHom.mapIntegralClosure.toRingHom

Extracted from #38144

Open in Gitpod

@yuanyi-350 yuanyi-350 added codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly labels Apr 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

PR summary 4fceb4697e

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.


No changes to technical debt.

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions Bot added the t-number-theory Number theory (also use t-algebra or t-analysis to specialize) label Apr 20, 2026
@yuanyi-350
Copy link
Copy Markdown
Collaborator Author

I ran a profiler comparison for the changed declarations in this PR.

Results (seconds):

  • NumberField.RingOfIntegers.mapRingHom: 0.366118 -> 0.049887 (-86.4%)

Overall:

  • mapRingHom elaboration got faster after replacing the hand-written ring hom structure with mapIntegralClosure.toRingHom.

@yuanyi-350 yuanyi-350 added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 25, 2026
@yuanyi-350 yuanyi-350 removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 28, 2026
@yuanyi-350 yuanyi-350 requested a review from mbkybky April 28, 2026 14:29
show f.symm w = (equivInfinitePlace K).symm w.1 by rfl,
show algebraMap (𝓞 K) K _ = algebraMap K⁺ K _ by rfl, equivInfinitePlace_symm_apply]
simp [f, g]
congr
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NumberField.RingOfIntegers.mapRingHom is not used anywhere else, so it is very strange that changing its definition affects the proof here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex OpenAI Codex wrote (parts of) this PR. LLM-generated PRs with substantial input from LLMs - review accordingly t-number-theory Number theory (also use t-algebra or t-analysis to specialize)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants